﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Distribution.Dto
@using FwProject.Core.Distribution
@model IPagedList<DistributionDetailsView>
@{
    Layout = null;
    int SumDistributioncount = 0;
    int SumRecoveryBycount = 0;
    int SumExchangegoodscount = 0;
    int SumDamagecount = 0;
    int SumGivecount = 0;
    int SumBackboxcount = 0;
    int SumBacknumbercount = 0;
    decimal SumPrice = 0;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {

            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
}
<div id="table_print">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px">序号</th>
                <th>结账状态</th>
                <th>结账时间</th>
                <th>配送单号</th>
                <th>餐厅名称</th>
                <th>配送日期</th>
                <th>配送箱数</th>
                <th>回收箱数</th>
                <th>换货箱数</th>
                <th>折损套数</th>
                <th>赠送箱数</th>
                <th>退回箱数</th>
                <th>退回套数</th>
                <th>金额（￥）</th>
                @*<th style="width:200px;">操作</th>*@
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td class="text-center" colspan="14">暂无配送签收信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    i++;
                    <tr>
                        <td>@i</td>
                        @if (item.Pricestatus == Pricestatus.未结账)
                        {
                            <td style="color:red">@item.Pricestatus</td>
                        }
                        else
                        {
                            <td>@item.Pricestatus</td>
                        }
                        <td>@(item.SettlementTime.HasValue ? item.SettlementTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")</td>
                        <td>@item.CreationNumber</td>
                        <td>@item.RestaurantName</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd hh:mm:ss")</td>
                        <td>@item.Distributioncount</td>
                        <td>@item.Recoverycount</td>
                        <td>@item.Exchangegoodscount</td>
                        <td>@item.Damagecount</td>
                        <td>@item.Givecount</td>
                        <td>@item.Backboxcount</td>
                        <td>@item.Backnumbercount</td>
                        <td>@item.TotalPrice</td>
                    </tr>
                    SumDistributioncount += item.Distributioncount;
                    SumRecoveryBycount += item.Recoverycount;
                    SumExchangegoodscount += item.Exchangegoodscount;
                    SumDamagecount += item.Damagecount;
                    SumGivecount += item.Givecount;
                    SumBackboxcount += item.Backboxcount;
                    SumBacknumbercount += item.Backnumbercount;
                    SumPrice += item.TotalPrice;
                }
                <tr class="footer">
                    <td style="color:red">合计</td>
                    <td colspan="5"></td>
                    <td style="color:red">@SumDistributioncount</td>
                    <td style="color:red">@SumRecoveryBycount</td>
                    <td style="color:red">@SumExchangegoodscount</td>
                    <td style="color:red">@SumDamagecount</td>
                    <td style="color:red">@SumGivecount</td>
                    <td style="color:red">@SumBackboxcount</td>
                    <td style="color:red">@SumBacknumbercount</td>
                    <td style="color:red">@SumPrice</td>
                </tr>
            }
        </tbody>
    </table>

</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        @Html.PagedListPager(Model, page => Url.Action("SignIndex", new { pageIdx = page, RestaurantName = Context.Request.Query["RestaurantName"], Pricestatus = Context.Request.Query["Pricestatus"], beginTime = Context.Request.Query["beginTime"], endTime = Context.Request.Query["endTime"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>



